package com.dbqn.zhao.service.impl;

import com.dbqn.zhao.service.BaseService;
import com.dbqn.zhao.service.StartServes;
import com.dbqn.zhao.util.ServiceFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.logging.Logger;

public class StartServesImpl implements BaseService {

    List list=new ArrayList();

    Scanner sc=new Scanner(System.in);

    @Override
    public List execute(List list) {

        System.out.println("欢迎使用书虫管理器");

        for (;;){

            System.out.println("----------------------------");
            System.out.println("1.登录");
            System.out.println("2.注册");
            System.out.println("3.退出");
            System.out.println("请选择：");
            int xz=sc.nextInt();



            switch (xz){

                case 1:
                    BaseService baseService =ServiceFactory.getService("login");
                    baseService.execute(list);
                    break;

                case 2:
                    BaseService baseService2 =ServiceFactory.getService("register");
                    baseService2.execute(list);
                    break;

                case 3:
                    System.out.println("欢迎下次光临！！");
                    System.exit(0);//停止虚拟机，程序结束

                default:
                    System.out.println("输入错误！请重新输入！");
                    break;

            }


        }


    }


}
